package com.jxtc.enterprise.tenant.vo;


import com.jxtc.enterprise.tenant.dto.TenantOrderStatisticDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

@Schema(description = "租户管理平台订单管理页面订单列表项")
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class TenantOrderVO {

    private String date;

    /**
     * 该订单属于那个用餐时段，比如 午餐 lunch
     */
    private String mealType;

    /**
     * 公司id
     */
    private String companyId;

    /**
     * 公司名称
     */
    private String companyName;

    /**
     * 点餐份数
     */
    private Integer orderCount;

    /**
     * 总金额，单位：元
     */
    private Integer totalAmount;

    /**
     * 公司地址
     */
    private String companyAddress;

    /**
     * 需要向店铺店主支付的货款
     */
    private Integer payForStores;

    public TenantOrderVO(TenantOrderStatisticDTO dto) {
        // this.date = dto.getOrderDate();
        // 仅展示用餐类型，已经将 午餐 后的 用餐时段 时间字符串删除了
        this.date = String.format("%s (%s)", dto.getOrderDate(), dto.getMealType());
        this.mealType = dto.getMealType();
        this.orderCount = dto.getOrderCount();
        this.totalAmount = dto.getTotalAmount();
        this.companyId = dto.getCompanyId();
        this.companyName = dto.getCompanyName();
        this.companyAddress = dto.getCompanyAddress();
        this.payForStores = dto.getPayForStores();
    }

    public Double getTotalAmount() {
        return totalAmount / 100.0;
    }

    public Double getPayForStores() {
        return payForStores / 100.0;
    }
}
